const Router = require('koa-router')
const router = new Router({ prefix: '/order' })
const { auth } = require('../middleware/auth.middleware')
const { orderValidator } = require('../middleware/order.middleware')
const { create, findAll, update } = require('../controller/order.controller')

router.post('/', auth, orderValidator({
    address_id: 'int',
    goods_info: 'string',
    total: "string"
}), create)
router.get('/', auth, findAll)
router.patch('/:id', auth, update)

module.exports = router